<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        /* json对象 */
        var cheng={
            "name":"wangyuhuan",
            age:20,
            sex:"女"
        }
        /* 2.读取对象属性的值 */
        console.log(cheng.name)
        /* Tip:如果属性名是变量的情况下，使用中括号去读取 */
        console.log(cheng["name"])
        /* 3.给对象新添加一个属性 */
        cheng.love="看电影"
        console.log(cheng)
        /* 4.读取对象所有的属性 */
        console.log(Object.keys(cheng))
        /* 5.读取对象所有的value值 */
        console.log(Object.values(cheng))
        /* 6.for in */
        for(var k in cheng){
            console.log(k)
            console.log(cheng[k])
        }
    </script>
</body>
</html>